const baseUrl = {
  // develop: 'http://192.168.1.107:9002/api',
  develop: 'https://pro.star.ihehang.com/api',
  trial: 'https://pro.star.ihehang.com/api',
  release: 'https://pro.star.ihehang.com/api'
}

enum Prefix {
//   develop = 'http://192.168.1.107:9002',
  develop = 'https://pro.star.ihehang.com',
  trial = 'https://pro.star.ihehang.com',
  release = 'https://pro.star.ihehang.com',
}
 enum ThreeHost{
//   develop = 'https://cdpre.tfsmy.com',
  develop = 'https://tfsmy.chengdu.gov.cn',
  trial = 'https://tfsmy.chengdu.gov.cn',
  release = 'https://tfsmy.chengdu.gov.cn',
 }
let uni_app_web_api_url = baseUrl['develop']
let prefix = Prefix['develop']

let env: UniApp.NavigateToMiniProgramOptions['envVersion'] = undefined

// #ifdef H5
env = (process.env.VITE_ENV as UniApp.NavigateToMiniProgramOptions['envVersion'])

uni_app_web_api_url = process.env.VITE_PROXY_KEY as string
prefix = Prefix[env as keyof UniApp.NavigateToMiniProgramOptions['envVersion'] === 'development' ? 'develop' : 'release']
// #endif

// #ifndef H5
const accountInfo = uni.getAccountInfoSync()

if (accountInfo) {
  const { version, envVersion } = accountInfo.miniProgram
  console.log('当前版本：', version, envVersion)
  env = envVersion
  uni_app_web_api_url = baseUrl[envVersion]
  prefix = Prefix[envVersion]
}
// #endif

export default {
  wx_id: 'wxd18ad716e8991562',
  web_name: '四川选星计划',
  uni_app_web_api_url, // 生产环境
  env,
  cityCode: '650109', // 城市码（改成接入城市的cityCode）
  appKey: '60a6310353b672649907c4a1', // 友盟统计的appKey
  prefix,
  three_host: ThreeHost[env], // 小程序登录域名（账号）
}
